package com.example.mybatisplus.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.damain.dto.PageDTO;
import com.example.mybatisplus.damain.po.Student;
import com.example.mybatisplus.damain.query.PageQuery;
import com.example.mybatisplus.damain.vo.StudentVo;
import com.example.mybatisplus.service.IStudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bilal
 * @since 2023-08-29
 */
@RestController
@RequestMapping("/student")
@Api(tags = "学生相关接口")
@RequiredArgsConstructor
public class StudentController {

    private final IStudentService studentService;

    @ApiOperation("查询学生-PageDTO")
    @GetMapping("/page1")
    public PageDTO<StudentVo> queryStudent(PageQuery query) {
        return studentService.queryStudent(query);
    }

    @ApiOperation("查询学生-Page")
    @GetMapping("/page2")
    public Page<Student> queryStudent2(PageQuery query){
        return studentService.queryStudent2(query);
    }

}
